<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Templog
 *
 * @author dung
 */
class Templog extends Eloquent
{

    //put your code here
    public $timestamps = false;

    public function saveItem($arrParams, $option = null)
    {
        $row = $this->where('code', '=', $arrParams['code'])->first();
        if (count($row) < 1)
            $row = new TempLog ();
        foreach ($arrParams as $key => $value)
            $row->{$key} = $value;
        $row->save();
    }

    public function getValue($code)
    {
        $row = $this->where('code', '=', $code)->first();
        if (count($row) > 0)
            return $row->value;
        else
            return 0;
    }

}
